﻿function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientAddHcc()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url = SharepointPortal.WebParts.Hcc.Hcc.GetAddNewUrl(belongSite).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
//    WorkflowStatusIndex=document.getElementById("divSelectWorkflowStatus").selectedIndex;
//    WorkflowStatus=document.getElementById("divSelectWorkflowStatus").options[WorkflowStatusIndex].value;
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;

    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}

function ClientSaveAddHcc()
{
    belongSite=document.getElementById("txtBelongSite").value;
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.AddHcc.ServerSideAddHcc(belongSite,language,Subject,bodyText,HccFieldsID,HccOfficeID).value;
    alert (value);
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    window.close();
}

function ClientSaveHcc(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    HccFieldsID=document.getElementById("divSelectHccFieldsName").options[document.getElementById("divSelectHccFieldsName").selectedIndex].value;
    HccOfficeID=document.getElementById("divSelectHccOfficeName").options[document.getElementById("divSelectHccOfficeName").selectedIndex].value;
    Subject=document.getElementById("txtSubject").value;
     if(FCKeditorAPI==null)
    {
    
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    var instanceName="ctl04";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    
    if(oEditor==null)
    {
        alert(SharepointPortal.WebParts.Hcc.UpdateHcc.GetLoadDataMsg().value);
        return;
    }
    bodyText= oEditor.GetXHTML( true );
    value = SharepointPortal.WebParts.Hcc.UpdateHcc.ServerSideHcc(language, HccIntroID,Subject,bodyText, HccFieldsID, HccOfficeID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetInfoSaveMsg(language).value;
    alert(retValue);
    window.close();
}

function RunFilter()
{
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealRunFilter()",100);
}


function RealRunFilter()
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divHccBody").innerHTML=value;
}


function ClientDeleteHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmMsg().value)==false)
    {
        return;
    }
    value=SharepointPortal.WebParts.Hcc.Hcc.ServerSideDeleteHcc(HccIntroID).value;
    if(value.indexOf("ERROR")!=-1)
    {
        alert(value);
        return;
    }
    alert(SharepointPortal.WebParts.Hcc.Hcc.GetDeleteOkMsg().value);
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    document.getElementById("divHccBody").innerHTML=value;
}

function ShowUpdateHccForm(HccIntroID)
{
    Url=SharepointPortal.WebParts.Hcc.Hcc.GetUpdateHccUrl(HccIntroID).value;
    window.showModalDialog(Url, null, 'dialogHeight: 600px; dialogWidth: 840px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    PageIndex=document.getElementById("divSelectPage").selectedIndex;
    value=SharepointPortal.WebParts.Hcc.Hcc.GetHtml(belongSite, HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")==-1)
    {
        document.getElementById("divHccBody").innerHTML=value;
    }
    else
    {
        alert(value);
    }
}


function DetectHccBody(HccIntroID)
{
    language=document.getElementById("divSelectLanguage").options[document.getElementById("divSelectLanguage").selectedIndex].value;
    retValue = SharepointPortal.WebParts.Hcc.UpdateHcc.GetSubject(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("txtSubject").value = retValue;
    
    var instanceName="ctl02";
    var oEditor = FCKeditorAPI.GetInstance(instanceName) ;
    retValue=SharepointPortal.WebParts.Hcc.UpdateHcc.GetBody(language,HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    oEditor.SetHcc(retValue);
    
}


function ClientPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSidePublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}




function ClientUnPublishingHcc(HccIntroID)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmUnPublishingMsg().value)==false)
    {
        return;
    }
    retValue = SharepointPortal.WebParts.Hcc.Hcc.ServerSideUnPublishing(HccIntroID).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    alert(retValue);
}

function DoSyncAll(belongSite)
{
    if(confirm(SharepointPortal.WebParts.Hcc.Hcc.GetConfirmSyncAllMsg().value)==false)
    {
        return;
    }
    document.getElementById("divProcessing").innerHTML=SharepointPortal.WebParts.Hcc.Hcc.GetProcessingText().value;
    setTimeout("RealDoSyncAll('"+belongSite+"')",10);
}



function RealDoSyncAll(belongSite)
{
    retValue=SharepointPortal.WebParts.Hcc.Hcc.SyncToServer(belongSite).value;
    document.getElementById("divProcessing").innerHTML="";
    alert(retValue);
}
function ClientJumpPageNews(TabModuleId,MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript)
{
    //document.getElementById("divProcessing").innerHTML = SharepointPortal.FrontEndWebParts.hcc.hccNewsByCategory.GetProcessingText().value;
    setTimeout("RealJumpPageNews('" + TabModuleId+"','"+CurrentPage + "')", 10);
}

function RealRunFilter(belongSite,TabModuleId, HasPorlet,PageIndex)
{
    HccFieldsNameIndex=document.getElementById("divSelectHccFieldsName").selectedIndex;
    HccFieldsID="";
    if(HccFieldsNameIndex!=-1)
    {
        HccFieldsID=document.getElementById("divSelectHccFieldsName").options[HccFieldsNameIndex].value;
    }
    
    HccOfficeNameIndex=document.getElementById("divSelectHccOfficeName").selectedIndex;
    HccOfficeID="";
    if(HccOfficeNameIndex!=-1)
    {
        HccOfficeID=document.getElementById("divSelectHccOfficeName").options[HccOfficeNameIndex].value;
    }
   
    if(PageIndex<0)PageIndex=0;
    value=SharepointPortal.FrontEndWebParts.hcc.hccGroupNews.GetHtml(belongSite, TabModuleId, HasPorlet,HccFieldsID, HccOfficeID, PageIndex).value;
    if(value.indexOf("ERROR")!=-1)
    {
        document.getElementById("divProcessing").innerHTML="";
        alert(value);
        return;
    } 
    document.getElementById("divHccBody").innerHTML=value;    
}
function RealJumpPageNews(TabModuleId,CurrentPage)
{
    ShortGroupNewsItemId=document.getElementById("txtShortGroupNewsItemId").value;
    PageIndex = CurrentPage;
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccNewsByCategory.GetHtml(TabModuleId, ShortGroupNewsItemId, CurrentPage).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divNewsByCategory").innerHTML=retValue;
}


function ClientDoAdvSearch(belongSite)
{
    keyword=document.getElementById("txtAdvKeyword").value;
    GroupNewsItemId=document.getElementById("drpSearchFromCategory").options[document.getElementById("drpSearchFromCategory").selectedIndex].value;
    if(GroupNewsItemId=='brl')
    {
        rValue=SharepointPortal.FrontEndWebParts.hcc.hccAdvanceSearch.GetSelectGroupMsg(belongSite).value;
        alert(rValue);
        return;
    }
    fromDate=document.getElementById("txtFromDate").value;
    toDate=document.getElementById("txtToDate").value;
    SortIndex=document.getElementById("drpSort").selectedIndex;
    LimitedItem=document.getElementById("drpSearchResultLimitedItem").options[document.getElementById("drpSearchResultLimitedItem").selectedIndex].value;
    PageSize=document.getElementById("drpSearchPageSize").options[document.getElementById("drpSearchPageSize").selectedIndex].value;
    url=SharepointPortal.FrontEndWebParts.hcc.hccAdvanceSearch.GetResultSearchUrl(belongSite,keyword,GroupNewsItemId,fromDate,toDate,SortIndex,LimitedItem,PageSize).value;
    
    if(url.indexOf("ERROR")!=-1)
    {
        alert(url);
        return;
    }
    window.open(url, '_self'); 
}


function JumpPageSearchResult(TabModuleId,MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript)
{
    document.getElementById("divProcessingSearchResult").innerHTML = SharepointPortal.FrontEndWebParts.hcc.hccResultSearchForService.GetProcessingText().value;
    setTimeout("RealJumpPageSearchResult('"+TabModuleId+"',"+MaxItems+","+ItemsPerRow+","+NoOfVisiblePage+","+CurrentPage+",'"+JumpJavaScript+"')",10);
}


function RealJumpPageSearchResult(TabModuleId,MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPage, JumpJavaScript)
{
    PageIndex = CurrentPage;
    
    belongSite=document.getElementById("txtBelongSite").value;
    ShortGroupNewsItemId=document.getElementById("txtShortGroupNewsItem").value;
    sId=document.getElementById("txtService").value;
    Keyword=document.getElementById("txtKeyword").value;
    fromDate=document.getElementById("txtFromDate").value;
    toDate=document.getElementById("txtToDate").value;
    PageSize=document.getElementById("txtPageSize").value;
    LimitedItem=document.getElementById("txtLimitedItem").value;
    SortType=document.getElementById("txtSortType").value;
    
    retValue=SharepointPortal.FrontEndWebParts.hcc.hccResultSearchForService.GetHtml(belongSite,TabModuleId,sId,Keyword,ShortGroupNewsItemId,fromDate,toDate,PageSize,LimitedItem,SortType,CurrentPage,JumpJavaScript).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("divProcessingSearchResult").innerHTML="";
    document.getElementById("divContentSearchResult").innerHTML=retValue;
}





function ClientSearchLawDocument(belongSite,LawDocumentId)
{
     document.getElementById("divProcessing").innerHTML=SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.GetProcessingText().value;
     setTimeout("RealClientSearchLawDocument('"+belongSite+"','"+LawDocumentId+"')",10);
}

function RealClientSearchLawDocument(belongSite,LawDocumentId)
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     PageIndex=0;
     if(document.getElementById("txtPageIndex")!=null)
     {
        PageIndex=document.getElementById("txtPageIndex").value;
     }
     
     retValue=SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.Search(LawDocumentId,belongSite,Code, Subject, LawDocumentSignerId, LawDocumentTypeId, LawDocumentOfficeId,PageIndex).value;
     if(retValue.indexOf("ERROR")!=-1)
     {
        document.getElementById("divProcessing").innerHTML="";
        alert(retValue);
        return;
     }
     document.getElementById("divProcessing").innerHTML="";
     document.getElementById("divFormResult").innerHTML=retValue;
}



function DownloadLawDocumentItem(LawDocumentItemId)
{
     Url=SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.ServerSideDownloadItem(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     //window.open(Url,"_self");
     ot = SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.CheckOpenType(Url).value;
     if(ot==1)
     {
        window.showModalDialog(Url, null, 'dialogHeight: 400px; dialogWidth: 580px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;'); 
     }
     else
     {
        window.open(Url,"_blank");
     }
}


function DownloadAllLawDocumentItem(LawDocumentItemId) {
    Url = SharepointPortal.FrontEndWebParts.hcc.hccAllLawDocument.ServerSideDownloadItem(LawDocumentItemId).value;
    if (Url.indexOf("ERROR") != -1) {
        alert(Url);
        return;
    }
    //window.open(Url,"_self");
    ot = SharepointPortal.FrontEndWebParts.hcc.hccAllLawDocument.CheckOpenType(Url).value;
    if (ot == 1) {
        window.showModalDialog(Url, null, 'dialogHeight: 400px; dialogWidth: 580px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;');
    }
    else {
        window.open(Url, "_blank");
    }
}



function DownloadLawDocumentItemFromView(LawDocumentItemId) {
    Url = SharepointPortal.FrontEndWebParts.hcc.hccViewLawDocument.ServerSideDownloadItem(LawDocumentItemId).value;
    if (Url.indexOf("ERROR") != -1) {
        alert(Url);
        return;
    }
    //window.open(Url,"_self");
    ot = SharepointPortal.FrontEndWebParts.hcc.hccViewLawDocument.CheckOpenType(Url).value;
    if (ot == 1) {
        window.showModalDialog(Url, null, 'dialogHeight: 400px; dialogWidth: 580px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;');
    }
    else {
        window.open(Url, "_blank");
    }
}


 
function ClientDoSimpleSearch(belongSite) 
{
   Keyword = document.getElementById("txtKeyword").value;
   if (Keyword.length < 3) {
       alert('Từ khóa tìm kiếm không hợp lệ!');
       return;
   }
   //Url = SharepointPortal.FrontEndWebParts.hcc.hccSimpleSearch.GetResultSearchUrl(belongSite,Keyword).value;
   Url = "SSResult.aspx?sKeyword=" + Keyword;
   if (Url.indexOf("ERROR")!=-1) 
   { 
       alert(Url); 
       return; 
   } 
   window.open(Url, "_self"); 
} 

function KeyPressForSearch(myfield,e,belongSite) 
{ 
    var keycode; 
    if (window.event) keycode = window.event.keyCode; 
        else if (e) keycode = e.which; 
            else return true; 
    if (keycode == 13) 
    { 
        ClientDoSimpleSearch(belongSite) 
        return false; 
    } 
    else 
    { 
        return true; 
    } 
}

/*
function JumpAlbumDetail(TabModuleId, MaxItem, ItemsPerRow, VisiblePage, CurrentPageIndex, Javascript) {
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccAlbumDetail.GetHtml(TabModuleId, CurrentPageIndex).value;
    document.getElementById("divListAlbumDetail").innerHTML = retValue;
}
*/

function JumpAlbumDetailWithZoom(TabModuleId, MaxItem, ItemsPerRow, VisiblePage, CurrentPageIndex, Javascript) {
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccAlbumDetail.GetHtmlWithZoom(TabModuleId, CurrentPageIndex).value;
    document.getElementById("divListAlbumDetail").innerHTML = retValue;
}

function JumpPageVideoDetail(TabModuleId, MaxItem, ItemsPerRow, VisiblePage, CurrentPageIndex, Javascript) {
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccVideoDetail.GetHtml(TabModuleId, CurrentPageIndex).value;
    document.getElementById("divVideoContentListDetail").innerHTML = retValue;
}

function BackImage(belongSite, AdvImageId, CurrentIndex) {
}

function NextImage(belongSite, AdvImageId, CurrentIndex) {
}


function ClientOpenLawDocumentItem(belongSite,LawDocumentItemId) {
    Url = SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.GetOpenDetailUrl(belongSite, LawDocumentItemId).value;
    if (Url.indexOf("ERROR") != -1) {
        alert(Url);
        return;
    }
    //window.showModalDialog(Url, null, 'dialogHeight: 400px; dialogWidth: 580px; dialogTop: 10px; dialogLeft: 150px; edge: Raised; center: Yes; help: No; scroll: Yes; status: Yes;');
    window.open(Url, "_blank");
}


function ClientOpenAllLawDocumentItem(belongSite, LawDocumentItemId) {
    Url = SharepointPortal.FrontEndWebParts.hcc.hccAllLawDocument.GetOpenDetailUrl(belongSite, LawDocumentItemId).value;
    if (Url.indexOf("ERROR") != -1) {
        alert(Url);
        return;
    }
    window.open(Url, "_blank");
}


function JumpPageLawDocumentItem(LawDocumentId, MaxItems, ItemsPerRow, VisiblePage, CurrentPageIndex, Javascript) {
    Code = document.getElementById("txtCode").value;
    Subject = document.getElementById("txtSubject").value;
    LawDocumentOfficeId = document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
    LawDocumentTypeId = document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
    LawDocumentSignerId = document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
    belongSite = document.getElementById("txtBelongSite").value;
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccLawDocument.Search(LawDocumentId, belongSite, Code, Subject, LawDocumentSignerId, LawDocumentTypeId, LawDocumentOfficeId, CurrentPageIndex).value;
    document.getElementById("divFormResult").innerHTML = retValue;
}


function JumpPageAllLawDocumentItem(LawDocumentId, MaxItems, ItemsPerRow, VisiblePage, CurrentPageIndex, Javascript) {
    belongSite = document.getElementById("txtBelongSite").value;
    retValue = SharepointPortal.FrontEndWebParts.hcc.hccAllLawDocument.Search(LawDocumentId, belongSite, CurrentPageIndex).value;
    document.getElementById("divFormResult").innerHTML = retValue;
}
